package com.vcredit.creditcat.enumtype;

/**
 * 联系人关系组
 * 
 *
 */

public enum RelationEnum {
	Relative(1, "Relative", "亲戚"), Friend(2, "friend", "朋友"), Workmate(3, "workmate", "同事"), Lover(4, "lover",
			"情侣"), Other(99, "other", "其他");

	private Integer code;
	private String name;
	private String desc;

	private RelationEnum(Integer code, String name, String desc) {
		this.code = code;
		this.name = name;
		this.desc = desc;
	}

	public Integer getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	public String getDesc() {
		return desc;
	}

	public static RelationEnum getEnumType(int value) {
		RelationEnum ret = null;
		for (RelationEnum obj : RelationEnum.values()) {
			if (value == obj.getCode()) {
				ret = obj;
				break;
			}
		}
		return ret;
	}

	public static RelationEnum getEnumType(String relation) {
		RelationEnum ret = null;
		for (RelationEnum obj : RelationEnum.values()) {
			if (null != relation && relation.equals(obj.getName())) {
				ret = obj;
				break;
			}
		}
		return ret;
	}

}
